package com.sz.designpattern.behavior11.iterator;

import java.util.ArrayList;
import java.util.List;

public class DeliveryAggregate implements Aggregate{
    private List<String> list = new ArrayList<>();
    @Override
    public int size() {
        return list.size();
    }

    @Override
    public void add(String tel) {
        list.add(tel);
    }

    @Override
    public void remove(String tel) {
        list.remove(tel);
    }

    @Override
    public String get(int location) {
        return list.get(location);
    }

    @Override
    public Iterator iterator() {
        return new DeliveryIterator(this);
    }
}
